[#import "/framework/JGP.htm"  as JGP]
<!--
项目   jgp-cloud-parent
作者   LOUFEI [Gavin]
时间   2018/6/3
-->
[@JGP.head "Title"/]
[@JGP.body]
    <jgp-div _row="['30','88','100','*']" _runit="px" _aux="true">
        <div slot="1-1">
            <jgp-btn _fn="saveCallback" _form="configForm">保存</jgp-btn>
        </div>
        <jgp-form slot="2-1" _cols="12" _id="configForm"
                  _action="/third/wx/wxConfigApiController/saveConfig">
            <jgp-text _col="12" _label="配置名" _name="name" _placeholder="配置名"></jgp-text>
            <jgp-text _col="12" _label="appId" _name="appId" _placeholder="appId"></jgp-text>
            <jgp-text _col="12" _label="appSecret" _name="appSecret" _placeholder="appSecret"></jgp-text>
        </jgp-form>
        <jgp-query slot="3-1" _id="queryConfigForm" _target="configGrid"
                   _action="/third/wx/wxConfigApiController/queryConfigs">
            <jgp-form-group _title="搜索">
                <jgp-text _col="12" _label="配置名" _name="name" _placeholder="配置名"></jgp-text>
            </jgp-form-group>
        </jgp-query>
        <jgp-grid slot="4-1" _id="configGrid" _single="true" _check="false"
                  _ondblclick="selectConfig"
                  _record_tools="[{'icon':'trash-o','tip':'删除','fn':'remove'}]"></jgp-grid>
    </jgp-div>
[/@JGP.body]

[@JGP.foot]
    <script>
        function saveCallback(result) {

            if (result.back && result.back.flag) {
                JGP.query('queryConfigForm').search();
                JGP.form('configForm').reset();
            }
        }

        function remove(result) {
            JGP.$confirm('是否确定删除:'+result.back.record.name+'?',function(){
                JGP.$post('/third/wx/wxConfigApiController/removeConfig',{id:result.back.record.id},function(){
                    JGP.query('queryConfigForm').search();
                })
            })
        }

        function selectConfig(result) {
            debugger
            JGP.$close(result.back.record.id)
        }
    </script>
[/@JGP.foot]